#ifndef DEF_DES_H
#define DEF_DES_H
	
	typedef struct des_context_ {
		unsigned long dsk[32] ;
		unsigned long esk[32] ;
	}des_context;
	
	
	typedef struct des3_context_ {
		unsigned long dsk[96] ;
		unsigned long esk[96] ;
	}des3_context;
	
	
	//--------------------DES---------------------//
	//set DES KEY (8byte)
	extern void des_set_key( des_context *ctx, unsigned char key[8] ) ;
	//for DES ECB
	extern void des_ecb_encrypt( des_context *ctx, 
					unsigned char *input,
					unsigned char *output,
					int len ) ;
	
	extern void des_ecb_decrypt( des_context *ctx, 
					unsigned char *input,
					unsigned char *output,
					int len ) ;
					
	
	//for DES CBC
	extern void des_cbc_encrypt( des_context *ctx,
						unsigned char iv[8],
						unsigned char *input,
						unsigned char *output,
						int len ) ;
	
	
	extern void des_cbc_decrypt( des_context *ctx,
						unsigned char iv[8],
						unsigned char *input,
						unsigned char *output,
						int len ) ;
	
	//--------------------3DES---------------------//
	
	//Set 3DES Key (24byte)
	extern void des3_set_3keys( des3_context *ctx, unsigned char key[24] ) ;
	//Set 3DES Key (16byte)
	extern void des3_set_2keys( des3_context *ctx, unsigned char key[16] ) ;
	
	//for 3DES ECB
	extern void des3_ecb_encrypt( des3_context *ctx,
						unsigned char input[8],
						unsigned char output[8],
						int len ) ;
	
	extern void des3_ecb_decrypt( des3_context *ctx,
						unsigned char input[8],
						unsigned char output[8],
						int len ) ;
	
	//for 3DES CBC				
	extern void des3_cbc_encrypt( des3_context *ctx,
						unsigned char iv[8],
						unsigned char *input,
						unsigned char *output,
						int len ) ;
	extern void des3_cbc_decrypt( des3_context *ctx,
						unsigned char iv[8],
						unsigned char *input,
						unsigned char *output,
						int len ) ;				

#endif
